package com.agan.jvm.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;
/**
 * @author 阿甘
 * @see https://study.163.com/course/introduction/1211562809.htm?share=1&shareId=1028852228
 * @version 1.0
 * 注：如有任何疑问,欢迎加阿甘老师微信agan-java 进行讨论
 */
@RestController
public class ItemController {

    @GetMapping(value = "/home")
    public  List<ItemVO> itemlist() throws InterruptedException {

        byte[] bytes1 = new byte[1024*5];
        //模拟业务操作 睡5毫秒
        Thread.sleep(5);
        byte[] bytes2 = new byte[1024*5];
        //模拟业务操作 睡5毫秒
        Thread.sleep(5);

        List<ItemVO>  items=getItems();
        return items;
    }




    private List<ItemVO> getItems(){
        List<ItemVO> list=new ArrayList<>();
        for (int i=0;i<10;i++){
            ItemVO vo=new ItemVO();
            vo.setId(i+1000);
            vo.setName("商品名称商品名称商品名称商品名称商品名称商品名称商品名称商品名称");
            vo.setCity("深圳");
            vo.setPrice(1000);
            vo.setNumber(50);
            vo.setPicture("https://edu-image.nosdn.127.net/38494654055d4f4fa29f542491692dfa.png?imageView&quality=100&crop=1_8_770_395&thumbnail=450y250");
            list.add(vo);
        }
        return list;
    }
}

